<template>
  <div style="padding: 15px">
    <!--<div style="margin-bottom: 15px;">-->
      <!--<DatePicker type="date" v-model="startDate" placeholder="开始时间" style="width: 200px"></DatePicker>-->
      <!--<DatePicker type="date" v-model="endDate" placeholder="结束时间" style="width: 200px"></DatePicker>-->
      <!--<Button type="success">搜索</Button>-->
    <!--</div>-->
    <Table border :columns="logTitle" :data="logList"></Table>
    <page-com :total="total" @page-change="pageChange"></page-com>
  </div>
</template>

<script>
  import PageCom from '_c/page'
  export default {
    name: 'theLog',
    data () {
      return {
        total: 0,
        number: 0,
        size: 10,
        startDate: '',
        endDate: '',
        logTitle: [
          {
            title: '账号',
            align: 'center',
            tooltip: true,
            key: 'username'
          },
          {
            title: '昵称',
            align: 'center',
            tooltip: true,
            key: 'nickName'
          },
          {
            title: 'ID',
            align: 'center',
            tooltip: true,
            key: 'id'
          },
          {
            title: '登陆时间',
            align: 'center',
            tooltip: true,
            key: 'createTime'
          }
        ],
        logList: []
      }
    },
    mounted() {
      this.logPage()
    },
    methods: {
      logPage() {
        this.$get('/api/loginRecord', {
          pageSize: this.number,
          pageNumber: this.size
        }).then((res) => {
          if (res.code === 0) {
            this.logList = res.data
            this.total = res.count
          } else {
            this.$Message.error('获取数据失败')
          }
        }).catch((rel) => {
          this.$Message.error('获取数据失败')
        })
      },
      pageChange(data) {
        this.number = data + 1
        this.logPage()
      }
    },
    components: {
      PageCom
    }
  }
</script>

<style scoped>

</style>

